.class Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;
.super Ljava/lang/Object;
.source "MsgPushService.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/netease/newsreader/service/MsgPushService;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = "DownloadDataThreadHandler"
.end annotation


# instance fields
.field final synthetic this$0:Lcom/netease/newsreader/service/MsgPushService;


# direct methods
.method constructor <init>(Lcom/netease/newsreader/service/MsgPushService;)V
    .locals 0
    .parameter

    .prologue
    .line 100
    iput-object p1, p0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 22

    .prologue
    .line 105
    :cond_0
    :goto_0
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v2}, Lcom/netease/newsreader/service/MsgPushService;->access$0(Lcom/netease/newsreader/service/MsgPushService;)Z

    move-result v2

    if-nez v2, :cond_1

    .line 214
    return-void

    .line 107
    :cond_1
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v2}, Lcom/netease/newsreader/service/MsgPushService;->access$1(Lcom/netease/newsreader/service/MsgPushService;)Landroid/content/SharedPreferences;

    move-result-object v2

    const-string v3, "autopost"

    const/16 v18, 0x0

    move/from16 v0, v18

    invoke-interface {v2, v3, v0}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v10

    .line 109
    .local v10, autopost:Z
    if-eqz v10, :cond_9

    .line 112
    const-string v17, ""

    .line 114
    .local v17, rst:Ljava/lang/String;
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v3}, Lcom/netease/newsreader/service/MsgPushService;->access$1(Lcom/netease/newsreader/service/MsgPushService;)Landroid/content/SharedPreferences;

    move-result-object v3

    const-string v18, "newestdocid"

    const-string v19, ""

    move-object/from16 v0, v18

    move-object/from16 v1, v19

    invoke-interface {v3, v0, v1}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v3

    invoke-static {v2, v3}, Lcom/netease/newsreader/service/MsgPushService;->access$2(Lcom/netease/newsreader/service/MsgPushService;Ljava/lang/String;)V

    .line 115
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v18

    move-wide/from16 v0, v18

    invoke-static {v2, v0, v1}, Lcom/netease/newsreader/service/MsgPushService;->access$3(Lcom/netease/newsreader/service/MsgPushService;J)V

    .line 116
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "http://p.3g.163.com/push/newsclient/?lastdocid="

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v3}, Lcom/netease/newsreader/service/MsgPushService;->access$4(Lcom/netease/newsreader/service/MsgPushService;)Ljava/lang/String;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v3}, Lcom/netease/newsreader/service/MsgPushService;->access$5(Lcom/netease/newsreader/service/MsgPushService;)I

    move-result v3

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    move-object/from16 v18, v0

    move-object/from16 v0, v18

    invoke-static {v2, v3, v0}, Lcom/netease/newsreader/util/HttpUtils;->getResponseFromGetUrlForPUSH(Ljava/lang/String;ILandroid/content/Context;)Ljava/lang/String;

    move-result-object v17

    .line 117
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v18

    move-wide/from16 v0, v18

    invoke-static {v2, v0, v1}, Lcom/netease/newsreader/service/MsgPushService;->access$6(Lcom/netease/newsreader/service/MsgPushService;J)V

    .line 120
    const-string v2, "error"

    move-object/from16 v0, v17

    invoke-virtual {v2, v0}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-eqz v2, :cond_2

    .line 123
    const-wide/32 v2, 0x927c0

    :try_start_0
    invoke-static {v2, v3}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    goto/16 :goto_0

    .line 124
    :catch_0
    move-exception v12

    .line 126
    .local v12, e:Ljava/lang/InterruptedException;
    invoke-virtual {v12}, Ljava/lang/InterruptedException;->printStackTrace()V

    goto/16 :goto_0

    .line 130
    .end local v12           #e:Ljava/lang/InterruptedException;
    :cond_2
    invoke-static/range {v17 .. v17}, Lcom/netease/newsreader/util/Tools;->StringToJson(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v15

    .line 134
    .local v15, jsonobj:Lorg/json/JSONObject;
    if-nez v15, :cond_3

    .line 137
    const-wide/32 v2, 0x927c0

    :try_start_1
    invoke-static {v2, v3}, Ljava/lang/Thread;->sleep(J)V
    :try_end_1
    .catch Ljava/lang/InterruptedException; {:try_start_1 .. :try_end_1} :catch_1

    goto/16 :goto_0

    .line 138
    :catch_1
    move-exception v12

    .line 140
    .restart local v12       #e:Ljava/lang/InterruptedException;
    invoke-virtual {v12}, Ljava/lang/InterruptedException;->printStackTrace()V

    goto/16 :goto_0

    .line 146
    .end local v12           #e:Ljava/lang/InterruptedException;
    :cond_3
    :try_start_2
    const-string v2, "pushresult"

    invoke-virtual {v15, v2}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v14

    .line 150
    .local v14, jsonarray:Lorg/json/JSONArray;
    if-eqz v14, :cond_4

    invoke-virtual {v14}, Lorg/json/JSONArray;->length()I

    move-result v2

    if-lez v2, :cond_4

    .line 152
    const/4 v13, 0x0

    .local v13, index:I
    :goto_1
    invoke-virtual {v14}, Lorg/json/JSONArray;->length()I

    move-result v2

    if-lt v13, v2, :cond_5

    .line 185
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v2}, Lcom/netease/newsreader/service/MsgPushService;->access$1(Lcom/netease/newsreader/service/MsgPushService;)Landroid/content/SharedPreferences;

    move-result-object v2

    invoke-interface {v2}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v2

    const-string v3, "newestdocid"

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    move-object/from16 v18, v0

    invoke-static/range {v18 .. v18}, Lcom/netease/newsreader/service/MsgPushService;->access$4(Lcom/netease/newsreader/service/MsgPushService;)Ljava/lang/String;

    move-result-object v18

    move-object/from16 v0, v18

    invoke-interface {v2, v3, v0}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    move-result-object v2

    invoke-interface {v2}, Landroid/content/SharedPreferences$Editor;->commit()Z
    :try_end_2
    .catch Lorg/json/JSONException; {:try_start_2 .. :try_end_2} :catch_5

    .line 191
    .end local v13           #index:I
    .end local v14           #jsonarray:Lorg/json/JSONArray;
    :cond_4
    :goto_2
    new-instance v2, Ljava/lang/StringBuilder;

    const-string v3, "end-start = "

    invoke-direct {v2, v3}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v3}, Lcom/netease/newsreader/service/MsgPushService;->access$9(Lcom/netease/newsreader/service/MsgPushService;)J

    move-result-wide v18

    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v3}, Lcom/netease/newsreader/service/MsgPushService;->access$10(Lcom/netease/newsreader/service/MsgPushService;)J

    move-result-wide v20

    sub-long v18, v18, v20

    move-wide/from16 v0, v18

    invoke-virtual {v2, v0, v1}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-static {v2}, Lcom/netease/newsreader/util/Logger;->i(Ljava/lang/String;)V

    .line 192
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v2}, Lcom/netease/newsreader/service/MsgPushService;->access$9(Lcom/netease/newsreader/service/MsgPushService;)J

    move-result-wide v2

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    move-object/from16 v18, v0

    invoke-static/range {v18 .. v18}, Lcom/netease/newsreader/service/MsgPushService;->access$10(Lcom/netease/newsreader/service/MsgPushService;)J

    move-result-wide v18

    sub-long v2, v2, v18

    const-wide/32 v18, 0x927c0

    cmp-long v2, v2, v18

    if-gez v2, :cond_0

    .line 194
    const-wide/32 v2, 0x927c0

    :try_start_3
    invoke-static {v2, v3}, Ljava/lang/Thread;->sleep(J)V
    :try_end_3
    .catch Ljava/lang/InterruptedException; {:try_start_3 .. :try_end_3} :catch_2

    goto/16 :goto_0

    .line 195
    :catch_2
    move-exception v12

    .line 197
    .restart local v12       #e:Ljava/lang/InterruptedException;
    invoke-virtual {v12}, Ljava/lang/InterruptedException;->printStackTrace()V

    goto/16 :goto_0

    .line 154
    .end local v12           #e:Ljava/lang/InterruptedException;
    .restart local v13       #index:I
    .restart local v14       #jsonarray:Lorg/json/JSONArray;
    :cond_5
    :try_start_4
    invoke-virtual {v14, v13}, Lorg/json/JSONArray;->get(I)Ljava/lang/Object;

    move-result-object v16

    check-cast v16, Lorg/json/JSONObject;

    .line 156
    .local v16, obj:Lorg/json/JSONObject;
    if-eqz v16, :cond_8

    .line 157
    const-string v2, "articleid"

    move-object/from16 v0, v16

    invoke-virtual {v0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    .line 158
    .local v4, articleid:Ljava/lang/String;
    const-string v2, "content"

    move-object/from16 v0, v16

    invoke-virtual {v0, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v11

    .line 161
    .local v11, content:Ljava/lang/String;
    move-object v5, v11

    .line 162
    .local v5, tickerText:Ljava/lang/String;
    const-string v6, "\u7f51\u6613\u65b0\u95fb"

    .line 163
    .local v6, contentTitle:Ljava/lang/String;
    move-object v7, v11

    .line 164
    .local v7, contentText:Ljava/lang/String;
    const v8, 0x7f0200f5

    .line 165
    .local v8, id:I
    const v9, 0x7f0200f5

    .line 167
    .local v9, resId:I
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v2}, Lcom/netease/newsreader/service/MsgPushService;->access$1(Lcom/netease/newsreader/service/MsgPushService;)Landroid/content/SharedPreferences;

    move-result-object v2

    const-string v3, "autopost"

    const/16 v18, 0x0

    move/from16 v0, v18

    invoke-interface {v2, v3, v0}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v10

    .line 168
    if-eqz v10, :cond_7

    .line 169
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v2}, Lcom/netease/newsreader/service/MsgPushService;->access$4(Lcom/netease/newsreader/service/MsgPushService;)Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v2, v4}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v2

    if-nez v2, :cond_6

    .line 170
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    move-object/from16 v0, p0

    iget-object v3, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v3}, Lcom/netease/newsreader/service/MsgPushService;->access$7(Lcom/netease/newsreader/service/MsgPushService;)Landroid/content/Intent;

    move-result-object v3

    invoke-static/range {v2 .. v9}, Lcom/netease/newsreader/service/MsgPushService;->access$8(Lcom/netease/newsreader/service/MsgPushService;Landroid/content/Intent;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;II)V
    :try_end_4
    .catch Lorg/json/JSONException; {:try_start_4 .. :try_end_4} :catch_5

    .line 175
    :cond_6
    const-wide/32 v2, 0xea60

    :try_start_5
    invoke-static {v2, v3}, Ljava/lang/Thread;->sleep(J)V
    :try_end_5
    .catch Ljava/lang/InterruptedException; {:try_start_5 .. :try_end_5} :catch_4
    .catch Lorg/json/JSONException; {:try_start_5 .. :try_end_5} :catch_5

    .line 180
    :cond_7
    :goto_3
    :try_start_6
    invoke-virtual {v14}, Lorg/json/JSONArray;->length()I

    move-result v2

    add-int/lit8 v2, v2, -0x1

    if-ne v13, v2, :cond_8

    .line 181
    move-object/from16 v0, p0

    iget-object v2, v0, Lcom/netease/newsreader/service/MsgPushService$DownloadDataThreadHandler;->this$0:Lcom/netease/newsreader/service/MsgPushService;

    invoke-static {v2, v4}, Lcom/netease/newsreader/service/MsgPushService;->access$2(Lcom/netease/newsreader/service/MsgPushService;Ljava/lang/String;)V
    :try_end_6
    .catch Lorg/json/JSONException; {:try_start_6 .. :try_end_6} :catch_5

    .line 152
    .end local v4           #articleid:Ljava/lang/String;
    .end local v5           #tickerText:Ljava/lang/String;
    .end local v6           #contentTitle:Ljava/lang/String;
    .end local v7           #contentText:Ljava/lang/String;
    .end local v8           #id:I
    .end local v9           #resId:I
    .end local v11           #content:Ljava/lang/String;
    :cond_8
    add-int/lit8 v13, v13, 0x1

    goto/16 :goto_1

    .line 205
    .end local v13           #index:I
    .end local v14           #jsonarray:Lorg/json/JSONArray;
    .end local v15           #jsonobj:Lorg/json/JSONObject;
    .end local v16           #obj:Lorg/json/JSONObject;
    .end local v17           #rst:Ljava/lang/String;
    :cond_9
    const-wide/32 v2, 0x2bf20

    :try_start_7
    invoke-static {v2, v3}, Ljava/lang/Thread;->sleep(J)V
    :try_end_7
    .catch Ljava/lang/InterruptedException; {:try_start_7 .. :try_end_7} :catch_3

    goto/16 :goto_0

    .line 206
    :catch_3
    move-exception v12

    .line 208
    .restart local v12       #e:Ljava/lang/InterruptedException;
    invoke-virtual {v12}, Ljava/lang/InterruptedException;->printStackTrace()V

    goto/16 :goto_0

    .line 176
    .end local v12           #e:Ljava/lang/InterruptedException;
    .restart local v4       #articleid:Ljava/lang/String;
    .restart local v5       #tickerText:Ljava/lang/String;
    .restart local v6       #contentTitle:Ljava/lang/String;
    .restart local v7       #contentText:Ljava/lang/String;
    .restart local v8       #id:I
    .restart local v9       #resId:I
    .restart local v11       #content:Ljava/lang/String;
    .restart local v13       #index:I
    .restart local v14       #jsonarray:Lorg/json/JSONArray;
    .restart local v15       #jsonobj:Lorg/json/JSONObject;
    .restart local v16       #obj:Lorg/json/JSONObject;
    .restart local v17       #rst:Ljava/lang/String;
    :catch_4
    move-exception v2

    goto :goto_3

    .line 188
    .end local v4           #articleid:Ljava/lang/String;
    .end local v5           #tickerText:Ljava/lang/String;
    .end local v6           #contentTitle:Ljava/lang/String;
    .end local v7           #contentText:Ljava/lang/String;
    .end local v8           #id:I
    .end local v9           #resId:I
    .end local v11           #content:Ljava/lang/String;
    .end local v13           #index:I
    .end local v14           #jsonarray:Lorg/json/JSONArray;
    .end local v16           #obj:Lorg/json/JSONObject;
    :catch_5
    move-exception v2

    goto/16 :goto_2
.end method
